home *** CD-ROM | disk | FTP | other *** search
- /* *****************************************************************************
- FILE: DialogUtil.c
-
- DESCRIPTION: Dialog box utilities
-
- AUTHOR: Kurt W.G. Matthies
-
- Copyright © 1990 by Code of the West, Inc., All Rights Reserved.
-
-
- Revision History:
- ==========================================================
- 3.30.90 - May 1990 MacUser Release
- ==========================================================
-
- ***************************************************************************** */
-
- #include "AppConstants.h"
- #include "DialogUtilPr.h"
-
- /* --------------------------------------------------------------------------
- dialogHookProcs - these hook procs do various things like
- 3.30.90kwgm highlight buttons, draw underlines, or handle
- keydown events in dialog boxes.
- ----------------------------------------------------------------------------- */
- pascal void
- buttonProc (theDialog, theItem)
- DialogPtr theDialog;
- short theItem;
- {
- short type;
- Rect box;
- Handle itemHdl;
-
- /* from IM-I, outline the default button */
- GetDItem (theDialog, kSetButtonID, &type, &itemHdl, &box);
-
- PenSize (3, 3);
- InsetRect (&box, -4, -4);
- FrameRoundRect (&box, 16, 16);
- PenNormal ();
-
- } /* buttonProc */
-
- /* ----------------------------------------------------------------------------------
- DLOGfilterProc1 - uses button 1 as default, button 2 as cancel
- 3.30.90kwgm processes Return, Enter and cmd .
- ------------------------------------------------------------------------------------- */
- pascal Boolean
- DLOGfilterProc1 (theDialog, theEvent, theItem)
- DialogPtr theDialog;
- EventRecord *theEvent;
- short *theItem;
- {
- short type;
- Rect box;
- char c;
- long endTicks;
- Boolean result;
- Handle item;
-
- c = (theEvent->message & charCodeMask);
-
- if (c == 13 || c == 3) /* return or enter */
- {
- GetDItem (theDialog, kSetButtonID, &type, &item, &box);
- if (type == (ctrlItem | btnCtrl))
- {
- HiliteControl (item, true);
- Delay (8, &endTicks);
- HiliteControl (item, false);
- }
- *theItem = kSetButtonID;
- theEvent->what = mouseDown;
- result = true;
- }
- else if (c == '.' && theEvent->modifiers & cmdKey) /* cmd . */
- {
- GetDItem (theDialog, kCancelButtonID, &type, &item, &box);
- if (type == (ctrlItem | btnCtrl))
- {
- HiliteControl (item, true);
- Delay (8, &endTicks);
- HiliteControl (item, false);
- }
- *theItem = kCancelButtonID;
- theEvent->what = mouseDown;
-
- result = true;
- }
- else
- result = false;
-
- return (result);
-
- } /* DLOGfilterProc1 */
-
- /* =========================================== EOF ========================================
- Copyright © 1990 by Code of the West, Inc., All Rights Reserved.
- ============================================================================================ */